#include "apfsds_config.h"

static tstack_t apdstinfo_tlsstk;
static TLS_INITIAL apdstls_t *apdstinfo_tls;
DEF_APDSTINFO_TLS(&apdstinfo_tlsstk, &apdstinfo_tls, malloc, APFSDS_COREID_UPDFREQ, mp_coreid)
static TLS_INITIAL spobj_t *lknode_tls;
DEF_LOCKNODE_SPSLAB(splknode, &lknode_tls, HDEF_CACHE_LINE_BYTES, SPLK_POOL_SIZE)

/* 使用spin_wait获得更高的性能提升 */
DEF_COMBINE(cacsffwd, cacsffwd, OUFUN_OF(apdstls), OUFUN_OF(spinyield_wait), OUFUN_OF(spslablknode))
// DEF_COMBINE(sffwd, sffwd, OUFUN_OF(apdstls), OUFUN_OF(spin_wait), OUFUN_OF(spslablknode))
APDS2APFSDS(cacsffwd, (OUFUN_OF(alignlknode))->get_lknode,  (OUFUN_OF(alignlknode))->ret_lknode)

/* 初始化 */
#include <pthreadalt/pthreadalt_init.h>
DEF_PTHREADALT_INIT
DEF_SYSINIT(apdstls)
DEF_CFLOWINIT(apdstls)
DEF_CFLOWFIN(apdstls, splknode)
DEF_SYSFIN(__omega)
